<html>
<head>
  <title>Evernote Export</title>
  <basefont face="微软雅黑" size="2" />
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  <meta name="exporter-version" content="YXBJ Windows/600753 (zh-CN, DDL); Windows/10.0.0 (Win64);"/>
  <style>
    body, td {
      font-family: 微软雅黑;
      font-size: 10pt;
    }
  </style>
</head>
<body>
<a name="1412"/>

<div>
<span><div><h2 style="margin: 10px 0px; padding: 0px; font-size: 21px; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="font-size: 16pt; font-family: Verdana;"><b><a href="https://www.cnblogs.com/betterwgo/p/8176525.html">https://www.cnblogs.com/betterwgo/p/8176525.html</a></b></span><br/></h2><h2 style="margin: 10px 0px; padding: 0px; font-size: 21px; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="font-size: 21px; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold; line-height: 1.5;">1.环境配置</span></h2><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal;">安装完python后，把python的include和lib拷贝到自己的工程目录下</span></div><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal;">安装路径下的include和libs</span><span style="color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-variant-caps: normal; font-variant-ligatures: normal;"><img src="c++调用python 脚本中的函数_files/Image.png" type="image/png" data-filename="Image.png" style="font-family: Verdana; font-size: 11pt;"/></span></div><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal;">然后在工程中包括进去（</span><span style="text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal;">放入c++项目中</span><span style="text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal;">）</span></div><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-variant-caps: normal; font-variant-ligatures: normal;"><img src="c++调用python 脚本中的函数_files/Image [1].png" type="image/png" data-filename="Image.png" style="font-family: Verdana; font-size: 11pt;"/></span></div><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal;"> </span><span style="font-size: 11pt; color: rgb(0, 0, 0); font-family: Verdana; font-variant-caps: normal; font-variant-ligatures: normal;"><img src="c++调用python 脚本中的函数_files/Image [2].png" type="image/png" data-filename="Image.png"/></span></div><h2 style="margin: 10px 0px; padding: 0px; font-size: 21px; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="font-size: 21px; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold; line-height: 1.5;">2.例子</span></h2><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal;">先写一个python的测试脚本，如下</span></div><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="font-size: 11pt; color: rgb(0, 0, 0); font-family: Verdana; font-variant-caps: normal; font-variant-ligatures: normal;"><img src="c++调用python 脚本中的函数_files/Image [3].png" type="image/png" data-filename="Image.png"/></span></div><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal;">这个脚本里面定义了两个函数Hello()和_add()。我的脚本的文件名叫mytest.py</span></div><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal;">C++代码：</span></div><div style="margin: 5px 0px; padding: 5px; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); overflow: auto; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 12px !important;"><div style="margin: 5px 0px 0px; padding: 0px; background-color: rgb(245, 245, 245);"><span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;"><img src="https://common.cnblogs.com/images/copycode.gif" style="margin: 0px; padding: 0px; border: none !important; background-color: rgb(245, 245, 245) !important; max-width: 900px; height: auto;"></img></span></div><div style="margin: 0px; padding: 0px; white-space: pre-wrap; overflow-wrap: break-word; font-size: 12px !important;"><div><span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">#include</span> <span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">stdafx.h</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">#include</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">&lt;stdlib.h&gt;</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">#include</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">&lt;iostream&gt;</span></div><div><br/></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">#include</span> <span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">include\Python.h</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span></div><div><br/></div><div><span style="font-size: 12px; color: rgb(0, 0, 255); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">using</span> <span style="font-size: 12px; color: rgb(0, 0, 255); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">namespace</span> <span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">std;</span></div><div><br/></div><div><span style="font-size: 12px; color: rgb(0, 0, 255); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">int</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">_tmain(</span><span style="font-size: 12px; color: rgb(0, 0, 255); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">int</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">argc, _TCHAR*</span> <span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">argv[])</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">{</span></div><div><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">//</span><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">初始化Python环境</span> <span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">Py_Initialize();</span></div><div><br/></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">PyRun_SimpleString(</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">import sys</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">);</span></div><div><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">//</span><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">添加Insert模块路径</span></div><div><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">//</span><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">PyRun_SimpleString(chdir_cmd.c_str());</span></div><div><span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">PyRun_SimpleString(</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">sys.path.append('./')</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">);</span></div><div><br/></div><div><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">//</span><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">导入模块</span></div><div><span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">PyObject* pModule = PyImport_ImportModule(</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">mytest</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">);</span></div><div><br/></div><div><span style="font-size: 12px; color: rgb(0, 0, 255); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">if</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">(!</span><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">pModule)</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">{</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">cout</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">&lt;&lt;</span> <span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">Python get module failed.</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">&lt;&lt;</span> <span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">endl;</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 255); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">return</span> <span style="font-size: 12px; color: rgb(128, 0, 128); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">0</span><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">;</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">}</span></div><div><br/></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">cout</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">&lt;&lt;</span> <span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">Python get module succeed.</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">&lt;&lt;</span> <span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">endl;</span></div><div><br/></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">PyObject</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">* pFunc =</span> <span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">NULL;</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">pFunc</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">= PyObject_GetAttrString(pModule,</span> <span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">Hello</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">);</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">PyEval_CallObject(pFunc, NULL);</span></div><div><br/></div><div><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">//</span><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">获取Insert模块内_add函数</span></div><div><span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">PyObject* pv = PyObject_GetAttrString(pModule,</span> <span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">_add</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">);</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 255); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">if</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">(!pv || !</span><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">PyCallable_Check(pv))</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">{</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">cout</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">&lt;&lt;</span> <span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">Can't find funftion (_add)</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">&lt;&lt;</span> <span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">endl;</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 255); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">return</span> <span style="font-size: 12px; color: rgb(128, 0, 128); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">0</span><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">;</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">}</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">cout</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">&lt;&lt;</span> <span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">Get function (_add) succeed.</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">&lt;&lt;</span> <span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">endl;</span></div><div><br/></div><div><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">//</span><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">初始化要传入的参数，args配置成传入两个参数的模式</span></div><div><span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">PyObject* args = PyTuple_New(</span><span style="font-size: 12px; color: rgb(128, 0, 128); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">2</span><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">);</span></div><div><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">//</span><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">将Long型数据转换成Python可接收的类型</span></div><div><span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">PyObject* arg1 = PyLong_FromLong(</span><span style="font-size: 12px; color: rgb(128, 0, 128); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">4</span><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">);</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">PyObject</span><span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">* arg2 = PyLong_FromLong(</span><span style="font-size: 12px; color: rgb(128, 0, 128); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">3</span><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">);</span></div><div><br/></div><div><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">//</span><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">将arg1配置为arg带入的第一个参数</span></div><div><span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">PyTuple_SetItem(args,</span> <span style="font-size: 12px; color: rgb(128, 0, 128); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">0</span><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">, arg1);</span></div><div><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">//</span><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">将arg1配置为arg带入的第二个参数</span></div><div><span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">PyTuple_SetItem(args,</span> <span style="font-size: 12px; color: rgb(128, 0, 128); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">1</span><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">, arg2);</span></div><div><br/></div><div><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">//</span><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">传入参数调用函数，并获取返回值</span></div><div><span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">PyObject* pRet =</span> <span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">PyObject_CallObject(pv, args);</span></div><div><br/></div><div><span style="font-size: 12px; color: rgb(0, 0, 255); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">if</span> <span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">(pRet)</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">{</span></div><div><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">//</span><span style="font-size: 12px; color: rgb(0, 128, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">将返回值转换成long型</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 255); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">long</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">result =</span> <span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">PyLong_AsLong(pRet);</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">cout</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">&lt;&lt;</span> <span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">result:</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span> <span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;">&lt;&lt; result &lt;&lt;</span> <span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">endl ;</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">}</span></div><div><br/></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">Py_Finalize();</span></div><div><br/></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">system(</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">pause</span><span style="font-size: 12px; color: rgb(128, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">&quot;</span><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">);</span></div><div><br/></div><div><span style="font-size: 12px; color: rgb(0, 0, 255); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">return</span> <span style="font-size: 12px; color: rgb(128, 0, 128); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">0</span><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">;</span></div><div><span style="font-size: 12px; color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-variant-caps: normal; font-variant-ligatures: normal; line-height: 1.5;">}</span></div></div><div style="margin: 5px 0px 0px; padding: 0px; background-color: rgb(245, 245, 245);"><span style="color: rgb(0, 0, 0); font-family: &quot;Courier New&quot;; font-size: 12px; font-variant-caps: normal; font-variant-ligatures: normal;"><img src="https://common.cnblogs.com/images/copycode.gif" style="margin: 0px; padding: 0px; border: none !important; background-color: rgb(245, 245, 245) !important; max-width: 900px; height: auto;"></img></span></div></div><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal;">注意脚本放的位置，确保C++代码可以引用它。</span></div><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal;">运行结果：</span></div><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="font-size: 11pt; color: rgb(0, 0, 0); font-family: Verdana; font-variant-caps: normal; font-variant-ligatures: normal;"><img src="c++调用python 脚本中的函数_files/Image [4].png" type="image/png" data-filename="Image.png"/></span></div><h2 style="margin: 10px 0px; padding: 0px; font-size: 21px; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="font-size: 21px; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold; line-height: 1.5;">3.python代码处理</span></h2><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal;">在发布软件的时候，通常我们都不希望代码可以直接被别人看到。</span></div><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal;">以上的Debug目录中的exe要想能够单独运行，必须把python脚本拷过去。为了不让别人能直接看到我的代码，我拷过去的是生成的.pyc文件</span></div><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="font-size: 11pt; color: rgb(0, 0, 0); font-family: Verdana; font-variant-caps: normal; font-variant-ligatures: normal;"><img src="c++调用python 脚本中的函数_files/Image [5].png" type="image/png" data-filename="Image.png"/></span></div><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-variant-caps: normal; font-variant-ligatures: normal;">拷过去之后修改文件名为：</span></div><div style="margin: 10px auto; padding: 0px; text-indent: 0px; font-size: 14px; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 238, 238);"><span style="font-size: 11pt; color: rgb(0, 0, 0); font-family: Verdana; font-variant-caps: normal; font-variant-ligatures: normal;"><img src="c++调用python 脚本中的函数_files/Image [6].png" type="image/png" data-filename="Image.png"/></span></div></div><div><br/></div></span>
</div></body></html> 